package com.zsj.dao;

import java.util.List;

import com.zsj.util.Constants;


/**
 * Dao层通用操作数据库类
 * 
 * @author Zsj
 *
 */
public class CommonDao extends BaseDao {

	public int insert(String key, Object object) {
		return this.getSqlSession().insert(key + Constants.INSERT, object);
	}

	public int delete(String key, String id) {
		return this.getSqlSession().delete(key + Constants.DELETE, id);
	}

	public int update(String key, Object object) {
		return this.getSqlSession().update(key + Constants.UPDATE, object);
	}

	public <T> T selectOne(String key, Object object) {
		return this.getSqlSession().selectOne(key + Constants.SELECT, object);
	}

	public <T> List<T> selectList(String key, Object object) {
		return this.getSqlSession().selectList(key + Constants.SELECT, object);
	}
	
	/**
	 *  调用存储过程
	 */
	public <T> T callPro(String key, Object object) {
		return this.getSqlSession().selectOne(key, object);
	}
}